<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
	<base href="<%=basePath%>">
		<meta charset="utf-8" />
		<title></title>
		<meta name="description" content="overview & stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link href="static/css/bootstrap.min.css" rel="stylesheet" />
		<link href="static/css/bootstrap-responsive.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="static/css/font-awesome.min.css" />
		<!-- 下拉框 -->
		<link rel="stylesheet" href="static/css/chosen.css" />
		<link rel="stylesheet" href="static/css/ace.min.css" />
		<link rel="stylesheet" href="static/css/ace-responsive.min.css" />
		<link rel="stylesheet" href="static/css/ace-skins.min.css" />
		<script type="text/javascript" src="static/js/jquery-1.7.2.js"></script>
		<!--提示框-->
		<script type="text/javascript" src="static/js/jquery.tips.js"></script>
<script type="text/javascript">
	
	top.hangge(); 
	
	//保存
	function save(){
			
			if($("#PASSWORD_OLD").val()==""){
				
				$("#PASSWORD_OLD").tips({
					side:3,
		            msg:'请输入旧密码',
		            bg:'#AE81FF',
		            time:2
		        });
				
				$("#PASSWORD_NEW").focus();
				return false;
			}
			if($("#PASSWORD_NEW").val()==""){
				
				$("#PASSWORD_NEW").tips({
					side:3,
		            msg:'请输入新密码',
		            bg:'#AE81FF',
		            time:2
		        });
				
				$("#PASSWORD_NEW").focus();
				return false;
			}
			if($("#PASSWORD_NEW").val()!=$("#PASSWORD_NEW_READY").val()){
				
				$("#PASSWORD_NEW_READY").tips({
					side:3,
		            msg:'两次密码不相同',
		            bg:'#AE81FF',
		            time:3
		        });
				
				$("#PASSWORD_NEW_READY").focus();
				return false;
			}
			var data={};
			data.USER_ID=$("#USER_ID").val();
			data.PASSWORD_OLD=$("#PASSWORD_OLD").val();
			data.PASSWORD_NEW=$("#PASSWORD_NEW").val();
			$.ajax({
				type: "POST",
				url: 'user/updatePassword',
		    	data: data,
		    	dataType:'jsonp',
		    	jsonp:"callback",
				cache: false,
				success: function(data, status, xhr){
					if(data.code=="200"){
						alert("修改成功");
						$("#zhongxin").hide();
						$("#zhongxin2").show();
						document.getElementById('zhongxin').style.display = 'none';
						top.Dialog.close();
					}else{
						alert("修改失败");
					}
					}
				});
			
			
	}
	
</script>
	</head>
<body >
	<center>
	<form action="user/editPwd.do" name="form1" id="form1"
		method="post" style="margin-top: 50px;">
		<input type="hidden" name="USER_ID" id="USER_ID" value="${pd.USER_ID }"/>
		<div id="zhongxin" style="width: 80%;">
			<table id="table_report" class="table table-striped table-bordered table-hover">
				<tr>
					<td style="width:90px;text-align: right;padding-top: 17px;font-size: 16px;">输入旧密码:</td>
					<td><input type="password" name="PASSWORD_OLD" id="PASSWORD_OLD"
						maxlength="32" placeholder="输入旧密码" title="密码" />
				</tr>
				<tr>
					<td style="width:90px;text-align: right;padding-top: 17px;font-size: 16px;">输入新密码:</td>
					<td><input type="password" name="PASSWORD_NEW" id="PASSWORD_NEW"
						maxlength="32" placeholder="输入新密码" title="密码" />
				</tr>
				<tr>
					<td style="width:90px;text-align: right;padding-top: 17px;font-size: 16px;">确认新密码:</td>
					<td><input type="password" name="PASSWORD_NEW_READY" id="PASSWORD_NEW_READY"
						maxlength="32" placeholder="确认新密码" title="确认密码" /></td>
				</tr>

				<tr>
					<td style="text-align: center;" colspan="10"><a
						class="btn btn-mini btn-primary" onclick="save();">保存</a> <a
						class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
					</td>
				</tr>
			</table>
		</div>
		</form>



	<div id="zhongxin2" class="center" style="display:none"><img src="static/images/jzx.gif"  style="width: 50px;" /><br/><h4 class="lighter block green"></h4></div>
		<!-- 引入 -->
		<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
		<script src="static/js/bootstrap.min.js"></script>
		<script src="static/js/ace-elements.min.js"></script>
		<script src="static/js/ace.min.js"></script>
		<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script><!-- 下拉框 -->
	</center>
</body>
</html>
